%link{href: "skin/blue.monday/jplayer.blue.monday.css", rel: 'stylesheet', type: 'text/css'}
%script{src: 'js/jquery.jplayer.min.js', type: 'text/javascript'}

%br
%br
.row
  #jquery_jplayer_1.jp-jplayer.center
  #jp_container_1.jp-audio.center
    .jp-type-single
      .jp-gui.jp-interface
        %ul.jp-controls
          %li
            %a.jp-play{:href => "javascript:;", :tabindex => "1"} play
          %li
            %a.jp-pause{:href => "javascript:;", :tabindex => "1"} pause
          %li
            %a.jp-stop{:href => "javascript:;", :tabindex => "1"} stop
          %li
            %a.jp-mute{:href => "javascript:;", :tabindex => "1", :title => "mute"} mute
          %li
            %a.jp-unmute{:href => "javascript:;", :tabindex => "1", :title => "unmute"} unmute
          %li
            %a.jp-volume-max{:href => "javascript:;", :tabindex => "1", :title => "max volume"} max volume
        .jp-progress
          .jp-seek-bar
            .jp-play-bar
        .jp-volume-bar
          .jp-volume-bar-value
        .jp-time-holder
          .jp-current-time
          .jp-duration
          %ul.jp-toggles
            %li
              %a.jp-repeat{:href => "javascript:;", :tabindex => "1", :title => "repeat"} repeat
            %li
              %a.jp-repeat-off{:href => "javascript:;", :tabindex => "1", :title => "repeat off"} repeat off
      .jp-title
        %ul
          %li= @short['name']
          %li= @short['description']
      .jp-no-solution
        %span Update Required
        To play the media you will need to either update your browser to a recent version or update your
        = succeed "." do
          %a{:href => "http://get.adobe.com/flashplayer/", :target => "_blank"} Flash plugin

:javascript

  $("#jquery_jplayer_1").jPlayer({
    ready: function () {
      $(this).jPlayer("setMedia", {
        #{@short['extension']}: "#{@short['url']}",
      });
    },
    play: function() { // To avoid both jPlayers playing together.
      $(this).jPlayer("pauseOthers");
    },
    repeat: function(event) { // Override the default jPlayer repeat event handler
      if(event.jPlayer.options.loop) {
        $(this).unbind(".jPlayerRepeat").unbind(".jPlayerNext");
        $(this).bind($.jPlayer.event.ended + ".jPlayer.jPlayerRepeat", function() {
          $(this).jPlayer("play");
        });
      } else {
        $(this).unbind(".jPlayerRepeat").unbind(".jPlayerNext");
        $(this).bind($.jPlayer.event.ended + ".jPlayer.jPlayerNext", function() {
          $("#jquery_jplayer_2").jPlayer("play", 0);
        });
      }
    },
    swfPath: "/flash",
    supplied: "#{@short['extension']}",
    wmode: "window"
  });

